Python Recipe Application

A Technical Case Study in Full-Stack Development & Deployment

1. Project Overview

The Python Recipe Application is a full-stack web application designed to allow users to browse and view detailed cooking recipes. The primary goal was to create a functional, database-driven application and manage its full lifecycle, from initial development to live deployment.

Objective:

To build a scalable and maintainable data-centric web app using Django, hosted on a cloud platform (Heroku).

2. Technical Stack

Backend & Framework

  • Python 3: Core language.
  • Django: Robust, full-stack web framework for rapid development.

Database & Hosting

  • PostgreSQL: Production-ready relational database.
  • Heroku: Cloud platform for live application deployment.

Frontend & Design

  • HTML/CSS: Templating and custom styling.
  • Django Templates: Server-side rendering for dynamic content.

Project Management

  • Git & GitHub: Version control and collaboration.

3. Key Features Implemented

4. Technical Challenges & Solutions

Challenge 4.1: Static Media Handling in Production

In the initial design, the recipe image was stored using Django's built-in `ImageField`. When deploying to Heroku, which uses an ephemeral file system, storing user-uploaded media (like images) directly is impossible. Standard practice involves using a third-party cloud storage service (like AWS S3).

Solution: Architectural Refactor. Instead of adding complex cloud storage dependencies, the `ImageField` was converted to a URLField. This shifted the responsibility of image storage to an external Content Delivery Network (CDN) or hosting service, allowing the application to simply store and retrieve a public URL string. This greatly simplifies the deployment architecture and reduces overhead.

Challenge 4.2: Template Dependency Fixes

The change from `ImageField` to `URLField` required updating all affected frontend templates (`list.html` and `recipe_detail.html`). These templates were previously attempting to access the `.url` attribute of the image object, which is only present on Django's file-based fields, not on plain string fields.

Solution: Targeted Template Correction. In both templates, the code was updated to reference the image source attribute directly:
<img src="{{ recipe.pic.url }}" ...>  <-- OLD (File Field)
<img src="{{ recipe.pic }}" ...>      <-- NEW (URL Field)
            
This ensures that the template correctly renders the image URL string provided by the database field.

5. Conclusion & Future Scope

The Recipe Application successfully demonstrates proficiency in Python/Django development, relational database integration (PostgreSQL), template rendering, and managing production deployment challenges on platforms like Heroku. The refactoring of the image handling process highlights the ability to adapt core architecture when facing platform constraints.

Future Enhancements: